<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/common/commonTag.jsp" %>
<!DOCTYPE html>
<html>
<head>
	<script type="text/javascript" src="${path}/common/js/print.js"></script>
</head>
<body>
	<div class="row-fluid">
		<div class="span1">
			<div class="btn-group">
			    <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
				    Action <i class="icon-chevron-down"></i>
				</a>
			    <ul class="dropdown-menu">
			        <li><a href="#" id="newAction"> <i class="icon-pencil"></i> New</a></li>
			        <li><a href="#" id="removeAllAction"> <i class="icon-trash"></i> Remove All</a></li>
			        <li><a href="#" id="exportExcelAction"> <i class="icon-download"></i> Export Excel</a></li>
			        <!-- <li class="divider"></li>
			        <li><a href="#" id="printAction"> <i class="icon-print"></i> Print</a></li>  -->
			    </ul>
			</div>
		</div>
		<div class="span2">
			<div class="input-prepend">
			    <input id="upload" name="upload" type="file" title="Search Excel File">
			    <button class="btn" type="button" id="importExcelAction"><i class="icon-upload"></i> Upload</button>
		    </div>
		</div>
		<div class="span9">
			<!-- <input type="text" class="typeahead span3" name="keywords" id="keywords" data-provide="typeahead" data-items="5" placeholder="search this gaid">  -->
		</div>
	</div>
</body>
<script type="text/javascript">
	function setSearch(url,vo){
		$('.typeahead').typeahead({
			source : function(keywords, process) {
				$.ajax({
					url : url,
					type : 'POST',
					dataType : 'JSON',
					async : true,
					data : vo + '.keywords=' + keywords,
					success : function(data) {
						var arr = [];
						for (var i in data) {
							arr.push(data[i]['pdt_name']);
						}
						process(arr);
					}
				});
			}
		})
	}

	function setNewAction(url)
    {
	    $("#newAction").bind("click", function()
	    {
		    window.location.href = url;
	    });
    }

    function setRemoveAllAction(url)
    {
	    $("#removeAllAction").bind("click", function()
	    {
		    $("form").attr("action", url).submit();
	    });
    }

    function setExportExcelAction(url)
    {
	    $("#exportExcelAction").bind("click", function()
	    {
		    $("form").attr("action", url).submit();
	    });
    }

    function setImportExcelAction(url)
    {
	    $("#importExcelAction").bind("click", function()
	    {
		    $("form").attr("enctype", "multipart/form-data").attr("action", url).submit();
	    });
    }

    function setPrintAction(selector)
    {
		$("#printAction").bind("click", function()
		{
			$(selector).printArea();
		});
    }
</script>
</html>